/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package View;

import Model.Status;
import java.util.ArrayList;
import javax.swing.ComboBoxModel;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;

/**
 *
 * @author kostas
 */
public class StatusDataModel implements ComboBoxModel {
    private ArrayList<Status> statuses;
    private String selected;

    public StatusDataModel(ArrayList<Status> statuses) {
        this.statuses = statuses;
    }

    public int getSize() {
        return statuses.size();
    }

    public String getElementAt(int index) {
        return statuses.get(index).getName();
    }

    public void setSelectedItem(Object anItem) {
        selected = anItem.toString();
    }

    public Object getSelectedItem() {
        return (Object) selected;
    }

    public void addListDataListener(ListDataListener l) {
        // I guess we don't need this...
    }

    public void removeListDataListener(ListDataListener l) {
        // And this...
    }

}
